#include <iostream>
#include "include/RtmpRecv.h"

#define MULTICAST_IP        "239.255.255.11"
#define MULTICAST_PORT      9832

using namespace std;



int main(int argc, char* argv[])
{
    if (argc != 4) {
        cout << "Usage: " << argv[0] << " <IP> <flv fileName> <fps>" << endl;
        return -1;
    }
    string ip(argv[1]);
    string fileName(argv[2]);

    int sockfd = sockets::createUdpSock();
    uint16_t port = 5001;
    int FPS = stoi(argv[3]);

    RtmpRecv* rtmp_recv = new RtmpRecv("rtmp://"+ ip + "/flv_test/test", fileName, 
                                sockfd, port, MULTICAST_IP, MULTICAST_PORT, FPS);
    if (!rtmp_recv->init()) {
        cout << "Initial RTMP failed...\n";
        return 0;
    };
    
    rtmp_recv->recv_send();
    cout << "Receive flv stream finish!" << endl;
    return 0;
}